using System;
using Microsoft.Practices.CompositeUI;
using Microsoft.Practices.CompositeUI.EventBroker;
using OrdersManager.Infrastructure.Interface;
using OrdersManager.Infrastructure.Interface.Constants;
using OrdersManager.Module.BusinessEntities;

namespace OrdersManager.Module.Tests.Mocks
{
	public class MockWorkItem : WorkItem
	{
		public event EventHandler<EventArgs<OrderCollection>> OrdersLoadedEvent;
        public event EventHandler<EventArgs<Order>> EditOrderEvent;

		[EventSubscription(EventTopicNames.OrdersLoaded, ThreadOption.UserInterface)]
		public void OnOrdersLoaded(object sender, EventArgs<OrderCollection> e)
		{
            if (OrdersLoadedEvent != null)
            {
                OrdersLoadedEvent(this, e);
            }
		}

        [EventSubscription(EventTopicNames.EditOrder)]
        public void OnEditOrder(object sender, EventArgs<Order> e)
        {
            if (EditOrderEvent != null)
            {
                EditOrderEvent(this, e);
            }
        }
    }
}